using System;
using System.Collections.Generic;
using System.Text;
using System.Data;


namespace Lapas.Common
{
    public static  class DateTimeInfo
    {
       
        public static DateTime GetFirstDayOfMonth()
        {
            return new DateTime(AppSettings.CurrentTransactionDate.Year, AppSettings.CurrentTransactionDate.Month, 1);
        }

        public static DateTime GetLastDayOfMonth()
        {
            return new DateTime(AppSettings.CurrentTransactionDate.Year, AppSettings.CurrentTransactionDate.Month, DateTime.DaysInMonth(AppSettings.CurrentTransactionDate.Year, AppSettings.CurrentTransactionDate.Month));
        }

        public static DateTime GetLastDayOfMonth(int month)
        {
            return new DateTime(AppSettings.CurrentTransactionDate.Year, month, DateTime.DaysInMonth(AppSettings.CurrentTransactionDate.Year, month));
        }

        public static DateTime GetLastDayOfMonth(int year, int month)
        {
            return new DateTime(year, month, DateTime.DaysInMonth(year, month));
        }

        public static DateTime GetFirstDayOfMonth(int month)
        {
            return new DateTime(AppSettings.CurrentTransactionDate.Year, month, 1);
        }

        public static DateTime GetFirstDayOfMonth(int year, int month)
        {
            return new DateTime(year, month, 1);
        }

        ///20071225 Haids
        ///
        public static DateTime GetFirstDayOfMonth(DateTime curTransDate)
        {
            return new DateTime(curTransDate.Year, curTransDate.Month, 1);
        }

        public static DateTime GetLastDayOfMonth(DateTime curTransDate)
        {
            return new DateTime(curTransDate.Year, curTransDate.Month, DateTime.DaysInMonth(curTransDate.Year, curTransDate.Month));
        }
        public static DateTime MinSqlDateTimeValue = new DateTime(1900, 1, 1);
        public static DateTime MaxSqlDateTimeValue = new DateTime(2079, 6, 6);

        public static DateTime MinLinqDate(this DateTime dt)
        {
            return new DateTime(1900, 1, 1);
        }
        public static DateTime MaxLinqDate(this DateTime dt)
        {
            return new DateTime(2079, 6, 6);
        }
    }

}
